package com.quanyan.financialSystem.web.place;

import com.quanyan.api.APIResponse;
import com.quanyan.common.Plugin.PageObj;
import com.quanyan.financialSystem.entity.vo.place.req.ReqMemberReconciliation;
import com.quanyan.financialSystem.entity.vo.place.req.ReqMemberReconciliationUpdate;
import com.quanyan.financialSystem.entity.vo.place.resp.MemberReconciliationVos;
import com.quanyan.financialSystem.service.place.MemberReconciliationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * MemberReconciliationController
 *
 * @author Tu Chun
 * @date 2016/10/24
 */
@RestController
@RequestMapping(value = "/admin/api/financial/place")
public class MemberReconciliationController {
    private Logger log = LoggerFactory.getLogger(ProfitLossReportFormController.class);
    @Autowired
    private MemberReconciliationService memberReconciliationService;

    @RequestMapping(value = "/memberReconciliation", method = RequestMethod.POST)
    public APIResponse<PageObj<MemberReconciliationVos>> memberReconciliation(@RequestBody ReqMemberReconciliation reqmemberReconciliation) {
        return memberReconciliationService.getMemberReconciliation(reqmemberReconciliation);
    }

    @RequestMapping(value = "/memberReconciliationAll", method = RequestMethod.POST)
    public APIResponse<MemberReconciliationVos> memberReconciliationAll(@RequestBody ReqMemberReconciliation reqmemberReconciliation) {
        return memberReconciliationService.memberReconciliationAll(reqmemberReconciliation);
    }
    @RequestMapping(value = "/updateMemberStatus", method = RequestMethod.POST)
    public APIResponse<?> updateMemberStatus(@RequestBody ReqMemberReconciliationUpdate reqmemberReconciliationUpdate) {
        String memberOrderNo=reqmemberReconciliationUpdate.getMemberOrderNo();
        if (memberOrderNo == null || "".equals(memberOrderNo)) {
            APIResponse.returnFail("订单号不能为空");
        }
        return memberReconciliationService.updateMemberStatus(reqmemberReconciliationUpdate);
    }
}
